package lx.prac.thymeleaf.conf;

import lx.prac.thymeleaf.interceptors.WebHandler;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;

@Configuration
public class MvcConfig extends WebMvcConfigurationSupport {
    @Override
    public  void configurePathMatch(PathMatchConfigurer configurer){

    }

    @Override
    protected void addViewControllers(ViewControllerRegistry registry) {

    }

    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");

        super.addResourceHandlers(registry);
    }

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new WebHandler()).addPathPatterns("/**");

        super.addInterceptors(registry);
    }
}
